/*
 * main.cpp
 *
 *  Created on: Jul 20, 2012
 *      Author: hxu
 *      Questions in Cracking coding interview, Chapter 2
 */

#include "linked_list.h"
#include<iostream>
#include<string>

using namespace std;

int main(int argc, char * argv[]) {
	cout << " Questions in Chapter 2, Cracking coding interview." << endl;
	string str_in = "";

	// read in inputs
	for(int i=1;i<=argc-1;i++){
		//cout << argv[i] << endl;
		str_in.append(argv[i]);
		str_in.append(" ");
	}

	/*cout << " Input list: ";
	cin >> str_in;*/
	cout << " Parsing ..." << endl;

	try {
		linked_list new_list(str_in);
		//new_list.remove_duplicate();
		//new_list.print_n_to_last(3);

		cout << " Stored list: " << new_list;
	} catch (string& err) {
		cout << " Error: " << err << endl;
		return 0;
	} catch (exception& e) {
		cout << e.what() << endl;
		return 0;
	}

	cout << " Mission complete!" << endl;

	cin.get();

	return 1;
}
